home *** CD-ROM | disk | FTP | other *** search
/ CrystalVision Software Se… Wiki Wonder - Wikipedia / CrystalVision Software Services 703: The Wiki Wonder - Wikipedia.iso / 0703 / Business / CodeX Apps / CodeX.exe / CodeX / html / iSpace / Pages.js < prev    next >
Encoding:
Text File  |  2007-01-07  |  21.4 KB  |  854 lines

  1. function AddImportedFile(ID)
  2. {
  3.     xajax_AddImportedFile(document.getElementById('FileSelector_'+ID).value, PostID);
  4. }
  5.  
  6. function AddImportedImage()
  7. {
  8.     xajax_AddImportedImage(document.getElementById('FileSelector').value, PostID);
  9. }
  10.  
  11. function SwitchFileMode(ID)
  12. {
  13.     if(document.getElementById('FileUpload_'+ID).style.display=='none')
  14.     {
  15.         document.getElementById('FileSelection_'+ID).style.display='none';
  16.         document.getElementById('FileUpload_'+ID).style.display='block';
  17.     }
  18.     else
  19.     {
  20.         document.getElementById('FileUpload_'+ID).style.display='none';
  21.         document.getElementById('FileSelection_'+ID).style.display='block';
  22.     }
  23. }
  24.  
  25. function ToggleSnapshots()
  26. {
  27.     if(document.getElementById('Snapshots').style.display=='none')
  28.     {
  29.         document.getElementById('CameraButton').className="ActivatedCamera";
  30.     }
  31.     else
  32.     {
  33.         document.getElementById('CameraButton').className="Camera";        
  34.     }
  35.     Effect.toggle('Snapshots', 'Blind', {duration:0.2});
  36. }
  37.  
  38. function SwitchToSnapshot(ID)
  39. {
  40.     document.getElementById("Snapshot_"+ID+"_Indicator").style.display='block';
  41.     
  42.     xajax_SwitchToSnapshot(ID);
  43. }
  44.  
  45. function AddSnapshot(ID)
  46. {
  47.     //setTimeout("Effect.Grow('Snapshot_"+ID+"', {duration:0.2});",1000);
  48.     
  49.     var NewWidth=document.getElementById('SnapshotsContainer').style.width.replace("px", "");
  50.     
  51.     document.getElementById('SnapshotsContainer').style.width=(NewWidth-0+175)+"px";
  52.     document.getElementById('Snapshot_'+ID).style.display='block';
  53.     new Effect.Highlight('Snapshot_'+ID, {duration:1});
  54.     
  55.     document.getElementById('CurrentState_Indicator').style.display='none';
  56. }
  57.  
  58. function TrashSnapshot(ID)
  59. {
  60.     Effect.Fade("Snapshot_"+ID, {duration:0.3});
  61.     var NewWidth=document.getElementById('SnapshotsContainer').style.width.replace("px", "");
  62.     setTimeout("document.getElementById('SnapshotsContainer').style.width='"+(NewWidth-170)+"px';", 500);
  63.     
  64.     xajax_TrashSnapshot(ID);
  65. }
  66.  
  67. function Snapshot(ID)
  68. {
  69.     document.getElementById(ID+"_Indicator").style.display='block';
  70.     
  71.     xajax_Snapshot(PostID);
  72. }
  73.  
  74. function Snapshot_ShowTrash(ID)
  75. {
  76.     document.getElementById(ID+"_Trash").style.display='block';
  77. }
  78. function Snapshot_HideTrash(ID)
  79. {
  80.     document.getElementById(ID+"_Trash").style.display='none';
  81. }
  82.  
  83. function ShowProgressBar(ID, Switch)
  84. {
  85.     document.getElementById(ID+"_Progress").style.display='block';
  86.     if(!Switch)
  87.         setTimeout('HideProgressBar(\''+ID+'\');', 5000);
  88. }
  89.  
  90. function HideProgressBar(ID)
  91. {
  92.     if(document.getElementById(ID+"_Progress"))
  93.         document.getElementById(ID+"_Progress").style.display='none';
  94. }
  95.  
  96. function HideProgress()
  97. {
  98.     document.getElementById('Page_Progress').style.display='none';
  99.     document.getElementById('Bottom_Progress').style.display='none';
  100. }
  101.  
  102. function Indicate(Text)
  103. {
  104.     //if(IndicateTimer)    clearTimeout(IndicateTimer);
  105.     document.getElementById('x_Indicator').innerHTML=Text;
  106.     
  107.     if(document.getElementById('x_Indicator').style.display=='none')
  108.     {
  109.         Effect.Appear('x_Indicator', {duration:0.5});
  110.     }
  111.     IndicateTimer=setTimeout("Effect.Fade('x_Indicator', {duration:0.6});", 3000);
  112. }
  113.  
  114. // Lists Related //
  115. function CheckThis(ID, Obj)
  116. {
  117.     //ShowProgressBar('Lists',1);
  118.     //setTimeout("HideProgressBar('Lists');", 1000);
  119.  
  120.     if(document.getElementById("Status_"+ID).className=='Status_Box')
  121.     {
  122.         document.getElementById("Status_"+ID).className = 'Status_Box SelectedStatus';
  123.         Obj.className = 'ListItem FinishedTask';
  124.     }
  125.     else
  126.     {
  127.         document.getElementById("Status_"+ID).className = 'Status_Box';
  128.         Obj.className = 'ListItem';
  129.     }
  130.     xajax_ModifyLists(ID);
  131.  
  132. }
  133.  
  134. function Stop_BodyEdit()
  135. {
  136.     clearInterval(BodySaveInterval);
  137.     document.getElementById('BodyPart_Box').style.display='none';
  138.     DisplayContent('x_PageBody');
  139. }
  140.  
  141.  
  142. function DisplayContent(ID)
  143. {
  144.     //Effect.toggle(ID, 'Appear', {duration:0.3, queue:{scope:'myscope', position:'end'}});
  145.     
  146.     if(document.getElementById(ID).style.display!="none")
  147.     {
  148.         document.getElementById(ID).style.display="none";
  149.         ShowSideNotes();
  150.         
  151.         ShowClips++;
  152.         MovePanel(ID);
  153.         
  154.         if(ID=="x_Notes_Patch")
  155.         {
  156.             RegisterDroppables('Notes');
  157.         }
  158.         else
  159.         {
  160.             RegisterDroppables('Body');
  161.         }
  162.     }
  163.     else
  164.     {
  165.         document.getElementById(ID).style.display="block";
  166.  
  167.         if(--ShowClips==0)
  168.         {
  169.             if(document.getElementById('SideNotes').style.display!='none')    Effect.Fade('SideNotes');
  170.         }
  171.     }
  172.     
  173. }
  174.  
  175. function AddEmotion(EmotionCode)
  176. {
  177.     document.getElementById('Body').value=document.getElementById('Body').value+EmotionCode;
  178. }
  179.  
  180. function ShowEmotions()
  181. {
  182.     if(document.getElementById('ExtraEmotions').style.display=='none')
  183.     {
  184.         document.getElementById('ExtraEmotions').style.display='inline-block';
  185.     }
  186.     else
  187.     {
  188.         document.getElementById('ExtraEmotions').style.display='none';
  189.     }
  190. }
  191.  
  192. function OpenPart(ID)
  193. {    
  194.     document.getElementById(ID).style.display="block";
  195.     document.getElementById(ID+"_btn").style.color='#888';
  196.     
  197.     if(!Hold)
  198.     {
  199.         //alert(ID);
  200.         Element.scrollTo(ID);
  201.         //window.location.href="#"+ID+"_Mark";
  202.     }
  203. }
  204.  
  205. function ClosePart(ID)
  206. {
  207.     document.getElementById(ID).style.display="none";
  208.     document.getElementById(ID+"_btn").style.color='#111';
  209.     document.getElementById(ID+"_btn").disabled=false;
  210. }
  211.  
  212. function ShowControls(ID)
  213. {
  214.     document.getElementById(ID+"_Control").style.display="inline";
  215. }
  216.  
  217. function HideControls(ID)
  218. {
  219.     document.getElementById(ID+"_Control").style.display="none";
  220. }
  221.  
  222. function AutoClip()
  223. {
  224.     var Selection;
  225.     if(Platform == "Macintosh")
  226.     {
  227.         Selection=new String(window.getSelection());
  228.     }
  229.     else
  230.     {
  231.         if(document.selection)
  232.         {
  233.             if(document.selection.type!='None')
  234.             Selection = document.selection.createRange().text;
  235.         }
  236.         else
  237.         {
  238.             if(document.getSelection())
  239.             Selection = document.getSelection();
  240.         }        
  241.     }
  242.  
  243.     //Selection=document.selection?(document.selection.type!='None'?document.selection.createRange().text:''):(document.getSelection?document.getSelection():'');
  244.  
  245.     if(Selection&&Selection.length>10)
  246.     {
  247.         document.getElementById('NewClip').value=Selection;
  248.  
  249.         var NewY=Event.pointerY(event)-400;
  250.         if(NewY<0)    NewY=0;
  251.         document.getElementById('Clips').style.top=NewY+'px';
  252.         
  253.         if(document.getElementById('AddNewClip').style.display=='none')    document.getElementById('AddNewClip').style.display='block';
  254.         if(document.getElementById('SideNotes').style.display=='none')    ShowSideNotes();
  255.     }
  256.     else
  257.     {
  258.         if(!ShowClips)
  259.         {
  260.             if(document.getElementById('SideNotes').style.display!='none')    Effect.Fade('SideNotes');
  261.         }
  262.     }
  263. }
  264.  
  265. function AdjustSideNotes()
  266. {
  267.     setTimeout("document.getElementById('SideNotes').style.height=(document.getElementById('MainArea').offsetHeight-00)+'px';", 500);
  268.     //setTimeout("alert(document.getElementById('MainArea').offsetHeight+' - '+document.getElementById('SideNotes').style.height);", 500);
  269. }
  270.  
  271.  
  272. function RefreshSideNotes()
  273. {
  274.     //alert('refreshing');
  275.     node=document.getElementById('SideNotes_Container');
  276.     if(Platform=="Macintosh")
  277.     {
  278.         
  279.     }
  280.     else
  281.     {
  282.         OrigData=node.innerHTML;
  283.         node.innerHTML="";
  284.         node.innerHTML=OrigData;
  285.     }
  286.     
  287.     var childrens = node.childNodes;        //ΦÄ╖σÅûnodeτÜäσà¿Θâ¿σ¡ÉΦèéτé╣
  288.  
  289.     for(var i=0;i<childrens.length;i++) {
  290.         var tmp=childrens[i];
  291.         if(tmp.tagName=='A')
  292.         {            
  293.             eval("SideNote_"+tmp.id+".destroy();");
  294.             eval("var SideNote_"+tmp.id+" = new Draggable('"+tmp.id+"', {revert:true, ghosting:true});");
  295.         }
  296.     }
  297. }
  298.  
  299. //var CursorMoved=0;
  300. function CopyClip(ID)
  301. {
  302.     return;
  303.     if(CursorMoved==1)    return false;
  304.     //add codes to copy the selected text clip to the clip board
  305.     //alert(CopyValue=document.getElementById(ID+"_Value").value);
  306.     //alert(Event.clipboardData);
  307.     CopyValue.execcommand("Copy");
  308.     document.getElementById('Clips_Notifier').innerHTML='Copied to clip board.';
  309.     Effect.BlindDown('Clips_Notifier', {duration:0.3});
  310.     setTimeout("Effect.BlindUp('Clips_Notifier', {duration:0.3});", 2000);
  311. }
  312.  
  313. var Marks=new Array();
  314. var CurrentMark;
  315. function MarkPosition(Mark, source)
  316. {
  317.     var NewY=Event.pointerY(source)-70;
  318.     if(NewY<0)    NewY=0;
  319.     Marks[Mark]=NewY+'px';
  320.     //alert(Mark+' = '+NewY+'px');
  321. }
  322.  
  323. function MovePanel(Mark)
  324. {
  325.     //alert('Trying to move to '+Mark+'. CurrentMark is '+CurrentMark);
  326.     if(Marks[Mark])
  327.         document.getElementById('Clips').style.top=Marks[Mark];
  328.     else
  329.         document.getElementById('Clips').style.top='0px';
  330. }
  331.  
  332. function ShowSideNotes()
  333. {
  334.     AdjustSideNotes();
  335.     if(document.getElementById('SideNotes').style.display=='none')    Effect.Appear('SideNotes');
  336. }
  337.  
  338. function ShowDeleteZone()
  339. {
  340.     //document.getElementById('DeleteZone').style.display='block';
  341.     Effect.Appear('DeleteZone', {duration:0.3});
  342. }
  343. function HideDeleteZone()
  344. {
  345.     setTimeout("document.getElementById('DeleteZone').style.display='none';", 50);
  346. }
  347.  
  348. function handleError() {
  349.     //RefreshSideNotes();
  350.     return true;
  351. }
  352.  
  353. //window.onerror = handleError;
  354.  
  355. function postClip(Note, ID)
  356. {
  357.     
  358.     ClipButton=document.getElementById('AddClip_Btn');
  359.     
  360.     ClipButton.disabled=1;
  361.     ClipButton.value='Adding...';
  362.     
  363.     xajax_EditSideNote(document.getElementById('NewClip').value, 'AUTO');
  364.  
  365.     Effect.BlindUp('AddNewClip', {duration:0.3});
  366.     
  367.     document.getElementById('NewClip').value='';
  368.     ClipButton.value=AddClipButtonCaption;
  369.     ClipButton.disabled=false;
  370.  
  371. }
  372.  
  373. // notes part
  374. function AddNote()
  375. {
  376.     ShowProgressBar('Notes');
  377.     xajax_AddNote(PostID, document.getElementById('Input_NoteTitle').value, document.getElementById('Input_NoteBody').value);
  378.     DisplayControls('NotesPart');
  379.     //Effect.BlindUp('NotesPart', {duration:0.3});
  380.     document.getElementById('Input_NoteBody').value='';
  381.     document.getElementById('Input_NoteTitle').value='';
  382.     DisplayContent('x_Notes_Patch');
  383. }
  384.  
  385. function DisplayControls(ID)
  386. {
  387.     //Effect.toggle(ID+"_Box", "Blind", {duration:0.3, queue:{scope:'myscope', position:'end'}});
  388.     //return;
  389.     
  390.     if(document.getElementById(ID+"_Box").style.display!="none")
  391.     {
  392.         if(document.getElementById(ID+"_Alternative"))
  393.             document.getElementById(ID+"_Alternative").style.display='block';
  394.             
  395.         document.getElementById(ID+"_Box").style.display="none";
  396.     }
  397.     else
  398.     {
  399.         if(document.getElementById(ID+"_Alternative"))
  400.             document.getElementById(ID+"_Alternative").style.display='none';
  401.             
  402.         document.getElementById(ID+"_Box").style.display="block";
  403.     }
  404.     //Element.scrollTo(ID+"_Box");
  405. }
  406.  
  407. function GalleryItem_DisplayControls(ID)
  408. {
  409.     if(document.getElementById(ID+"_Box").style.display!="none")
  410.     {
  411.         document.getElementById(ID+"_Box").style.display="none";
  412.         document.getElementById(ID+"_Description").style.display="block";
  413.     }
  414.     else
  415.     {
  416.         document.getElementById(ID+"_Box").style.display="block";
  417.         document.getElementById(ID+"_Description").style.display="none";
  418.         document.getElementById("Input_Image_Desc_"+ID).focus();
  419.     }
  420. }
  421. function Start_BodyEdit()
  422. {
  423.     if(document.getElementById('BodyPart_Box').style.display!='none')    return;
  424.  
  425.     document.getElementById('BodyPart_Box').style.display='block';
  426.     //DisplayControls('BodyPart');
  427.     DisplayContent('x_PageBody');
  428.     Element.scrollTo('Body');
  429.     document.getElementById('Body').focus();
  430.     if(AutoSave==1)
  431.     {
  432.         BodySaveInterval=setInterval("SaveBody();", 300*1000);    //save the body every 300 secs
  433.         Indicate(AutoSave_On);
  434.     }
  435.     else
  436.     {
  437.         Indicate(AutoSave_Off);
  438.         BodySaveInterval=setInterval("Indicate("+Save_Prompt+");", 300000);    //prompt to save the body every 300 secs
  439.     }
  440. }
  441.  
  442. function SaveBody(Method)
  443. {
  444.     xajax_ModifyBody(PostID, document.getElementById('Body').value);
  445.     
  446.     if(Method==1)    //user action
  447.     {
  448.         Stop_BodyEdit();
  449.     }
  450.     
  451.     Indicate(BodySaved);
  452. }
  453.  
  454. function DisplayHelp(ID, Quick)
  455. {
  456.     if(!Quick)
  457.     {
  458.         Effect.toggle(ID+'_Help','BLIND', {duration:0.1});
  459.     }
  460.     else
  461.     {
  462.         if(document.getElementById(ID+"_Help").style.display!="none")
  463.         {
  464.             document.getElementById(ID+"_Help").style.display="none";
  465.         }
  466.         else
  467.         {
  468.             document.getElementById(ID+"_Help").style.display="inline-block";
  469.         }
  470.     }
  471. }
  472.  
  473. function HideProgress()
  474. {
  475.     document.getElementById('Page_Progress').style.display='none';
  476. }
  477.  
  478.  
  479. function Trash(ID)
  480. {
  481.     if(confirm(DeleteConfirmText))
  482.     {
  483.         Effect.BlindUp('Segment_'+ID, {duration:0.4});
  484.         xajax_RemoveItem(ID);
  485.     }
  486.     return;
  487. }
  488.  
  489. function SwitchPage(ID)
  490. {
  491.     Effect.Appear('Page_Switching_Indicator', {duration:0.3});
  492.     xajax_SwitchThis(ID);
  493. }
  494.  
  495.  
  496. function hotKeys (event) {
  497.  
  498.   // Get details of the event dependent upon browser
  499.   event = (event) ? event : ((window.event) ? event : null);
  500.   
  501.   // We have found the event.
  502.   if (event) {   
  503.     
  504.     // Hotkeys require that either the control key or the alt key is being held down
  505.     if (event.ctrlKey || event.altKey || event.metaKey) {
  506.     
  507.       // Pick up the Unicode value of the character of the depressed key.
  508.       var charCode = (event.charCode) ? event.charCode : ((event.which) ? event.which : event.keyCode);
  509.       
  510.       // Convert Unicode character to its lowercase ASCII equivalent
  511.       var myChar = String.fromCharCode (charCode).toLowerCase();
  512.       
  513.       // Convert it back into uppercase if the shift key is being held down
  514.       if (event.shiftKey) {myChar = myChar.toUpperCase();}
  515.           
  516.       // Now scan through the user-defined array to see if character has been defined.
  517.       for (var i = 0; i < keyActions.length; i++) {
  518.          
  519.         // See if the next array element contains the Hotkey character
  520.         if (keyActions[i].character == myChar) { 
  521.       
  522.           // Yes - pick up the action from the table
  523.           var action;
  524.             
  525.           // If the action is a hyperlink, create JavaScript instruction in an anonymous function
  526.           if (keyActions[i].actionType.toLowerCase() == "link") {
  527.             action = new Function ('location.href  ="' + keyActions[i].param + '"');
  528.           }
  529.             
  530.           // If the action is JavaScript, embed it in an anonymous function
  531.           else if (keyActions[i].actionType.toLowerCase()  == "code") {
  532.             action = new Function (keyActions[i].param);
  533.           }
  534.             
  535.           // Error - unrecognised action.
  536.           else {
  537.             alert ('Hotkey Function Error: Action should be "link" or "code"');
  538.             break;
  539.           }
  540.            
  541.           // At last perform the required action from within an anonymous function.
  542.           action ();
  543.          
  544.           // Hotkey actioned - exit from the for loop.
  545.           break;
  546.         }
  547.       }
  548.     }
  549.   }
  550. }
  551.  
  552.  
  553. function getMimeType()
  554. {
  555.     var  mimeType = "application/x-mplayer2"; //default
  556.     var agt=navigator.userAgent.toLowerCase();
  557.     var is_mac = (agt.indexOf("mac")!=-1); 
  558.     with (navigator)
  559.     {
  560.         if (mimeTypes && !(agt.indexOf("windows")!=-1 && agt.indexOf("windows 3.1")==-1))
  561.         {
  562.              //non-IE, no Windows
  563.             var plugin = mimeTypes["audio/mpeg"].enabledPlugin;
  564.             if (plugin) mimeType = "audio/mpeg";     //mac/Safari
  565. /*            else
  566.         {
  567.                 plugin = mimeTypes["audio/mpeg-url"].enabledPlugin;
  568.             if (plugin) mimeType = "audio/mpeg-url" // non-IE 2nd favorite (Linux/FF)
  569.         }
  570. */
  571.      }//end no-Windows 
  572.     }//end with (navigator)
  573.     return mimeType;
  574. }//end function getMimeType
  575.  
  576. function setEmbed(ID, root){
  577.     var element = document.getElementById(ID);
  578.     element.innerHTML ='<embed src="'+root+'" autostart="0" loop="0" class="EmbedPlayer" type="'+getMimeType()+'"></embed>';
  579. }// end function setEmbed
  580.  
  581. function ShowEmbed(ID, root)
  582. {
  583.     var element = document.getElementById(ID);
  584.     if(!element.innerHTML)    setEmbed(ID, root);
  585. }
  586.  
  587. function EditGroupTitle(GroupID, SaveOrNot, NewTitle)
  588. {
  589.     if(document.getElementById('GroupBox_'+GroupID).style.display=='none')
  590.     {
  591.         document.getElementById('GroupBox_'+GroupID).style.display = 'block';
  592.         document.getElementById('GroupTitle_'+GroupID).style.display = 'none';
  593.     }
  594.     else
  595.     {
  596.         document.getElementById('GroupBox_'+GroupID).style.display = 'none';
  597.         document.getElementById('GroupTitle_'+GroupID).style.display = 'block';
  598.     }
  599.     
  600.     if(SaveOrNot == 1)
  601.     {
  602.         document.getElementById('GroupTitle_'+GroupID).innerHTML = NewTitle;
  603.         xajax_ModifyListGroupTitle(GroupID, NewTitle);
  604.     }
  605. }
  606.  
  607. function TrashListingGroup(GroupID)
  608. {
  609.     if(confirm("Are you sure to delete this list?\nThis will delete all its items."))
  610.     {
  611.         //Effect.Fade("Group_"+GroupID, {duration:0.3});
  612.         ShowProgressBar("Lists");
  613.         xajax_TrashListing(PostID, GroupID);
  614.     }
  615. }
  616.  
  617. function TrashListItem(ID)
  618. {
  619.     if(confirm(DeleteConfirmText))
  620.     {
  621.         Effect.Fade("List_"+ID, {duration:0.3});
  622.         xajax_TrashListing(ID);
  623.     }
  624.     return;
  625. }
  626.  
  627.  
  628. function ToggleListEdit(ID)
  629. {
  630.     if(document.getElementById('List_Display_'+ID).style.display=='none')
  631.     {
  632.         document.getElementById('List_Edit_'+ID).style.display = 'none';
  633.         document.getElementById('List_Display_'+ID).style.display = 'block';
  634.     }
  635.     else
  636.     {
  637.         document.getElementById('List_Display_'+ID).style.display = 'none';
  638.         document.getElementById('List_Edit_'+ID).style.display = 'block';
  639.         
  640.         document.getElementById('List_ItemName_Input_'+ID).focus();
  641.     }
  642. }
  643.  
  644. function SaveList(ID, ItemTitle, ItemDesc)
  645. {
  646.     document.getElementById('List_Edit_'+ID).innerHTML = "<img src='/img/App_GUI/Misc/indicator_3.gif' width='16' height='16' border='0' style='margin:10px 0 10px 45px;' />";
  647.     
  648.     xajax_SaveListItem(PostID, ID, ItemTitle, ItemDesc);
  649. }
  650.  
  651. function ShareMe()
  652. {
  653.     //document.getElementById('SharePage').innerHTML = "<img src='/img/App_GUI/Misc/indicator_3.gif' width='16' height='16' border='0' style='float:right' />";
  654.     
  655.     //xajax_SharePage(PostID);
  656.     //return;
  657.     
  658.     
  659.     obj=document.getElementById('SubscriberIcon');
  660.     
  661.     if(obj.className=='btnShare')
  662.     {
  663.         obj.className = 'btnShare_Active';
  664.         //document.getElementById('SharePage').className = 'SharedPage';
  665.         document.getElementById('ShareStatus').style.display = 'block';
  666.         document.getElementById('ShareStatus').innerHTML = "<img src='/img/App_GUI/Misc/indicator_3.gif' width='16' height='16' border='0' style='float:right' />";
  667.         xajax_SharePage(PostID);
  668.     }
  669.     else
  670.     {
  671.         obj.className = 'btnShare';
  672.         //document.getElementById('SharePage').className = '';
  673.         document.getElementById('ShareStatus').style.display = 'none';
  674.         xajax_SharePage(PostID);
  675.     }
  676. }
  677.  
  678. function AddNewContent(Type, ID)
  679. {
  680.     var Switcher = '0';
  681.     if(ID=='Top')    Switcher = '1';
  682.         
  683.     document.getElementById('AddContent_'+ID).style.display = 'none';
  684.     
  685.     switch(Type)
  686.     {
  687.         case "Text":
  688.             document.getElementById('AddNew_'+ID+'_Link').innerHTML = "+ Adding...";
  689.             xajax_AddText(PostID, Switcher);
  690.             break;
  691.         case "List":
  692.             document.getElementById('AddNew_'+ID+'_Link').innerHTML = "+ Adding...";
  693.             xajax_AddList(PostID, Switcher);
  694.             break;
  695.         case "File":
  696.             document.getElementById('FileUpload_Panel_'+ID).style.display='block';
  697.             break;
  698.         case "Link":
  699.             document.getElementById('Links_Panel_'+ID).style.display='block';
  700.             break;
  701.         default:
  702.             document.getElementById('AddNew_'+ID+'_Link').innerHTML = "+ Adding...";
  703.             xajax_AddNewFile(PostID, Type, Switcher);
  704.             break;
  705.     }
  706. }
  707.  
  708. function ToggleSegmentEdit(ID, SaveOrNot)
  709. {
  710.     if(document.getElementById('Segment_'+ID+'_Edit').style.display=='none')
  711.     {
  712.         //display edit layout
  713.         
  714.         document.getElementById('Segment_'+ID+'_Edit').style.display = 'block';
  715.         
  716.         if(document.getElementById('Segment_'+ID+'_Display'))
  717.         {
  718.             document.getElementById('Segment_'+ID+'_Display').style.display = 'none';
  719.         }
  720.         
  721.         if(document.getElementById('Segment_'+ID+'_EditIcon'))
  722.             document.getElementById('Segment_'+ID+'_EditIcon').style.visibility = 'hidden';
  723.         
  724.     }
  725.     else
  726.     {
  727.         //hide edit layout
  728.         
  729.         document.getElementById('Segment_'+ID+'_Edit').style.display = 'none';
  730.  
  731.         if(document.getElementById('Segment_'+ID+'_Display'))
  732.             document.getElementById('Segment_'+ID+'_Display').style.display = 'block';
  733.  
  734.         if(SaveOrNot)
  735.         {
  736.             if(document.getElementById('Segment_'+ID+'_Display'))
  737.             {
  738.                 document.getElementById('Segment_'+ID+'_Display').innerHTML = "<img src='/img/App_GUI/Misc/indicator_3.gif' width='16' height='16' /><br /> ";
  739.             }
  740.             else
  741.             {
  742.                 document.getElementById('Segment_'+ID+'_EditIcon').style.visibility = 'visible';
  743.                 document.getElementById('Segment_'+ID+'_EditIcon').innerHTML = 'Adding...';
  744.             }
  745.             
  746.             xajax_SaveChanges(xajax.getFormValues('Segment_'+ID+'_Edit'));
  747.         }
  748.         //alert('showing');
  749.         if(document.getElementById('Segment_'+ID+'_EditIcon'))
  750.             document.getElementById('Segment_'+ID+'_EditIcon').style.visibility = '';
  751.     }
  752. }
  753.  
  754. function SaveList(DataAddress, ItemID, ListName, ListDesc)
  755. {
  756.     document.getElementById('List_Edit_'+DataAddress+"_"+ItemID).innerHTML = "<img src='/img/App_GUI/Misc/indicator_3.gif' width='16' />";
  757.     xajax_SaveListItem(DataAddress, ItemID, ListName, ListDesc);
  758. }
  759.  
  760. function ToggleAddNew(ID)
  761. {
  762.     if(document.getElementById('AddContent_'+ID).style.display=='none')
  763.     {
  764.         document.getElementById('AddContent_'+ID).style.display='block';
  765.     }
  766.     else
  767.     {
  768.         document.getElementById('AddContent_'+ID).style.display='none';
  769.     }
  770.     
  771.     if(ID=="Bottom")
  772.     {
  773.         //if(parent.getElementById('MainWindow'))    parent.getElementById('MainWindow').scrollTop+=9999;
  774.         window.scrollBy(0, 9999);
  775.     }
  776. }
  777.  
  778. function PreviewImage(x)
  779. {
  780.     var y = document.getElementById("PreviewImage_Zone");
  781.     if(!x || !y) return;
  782.     var patn = /\.jpg$|\.jpeg$|\.gif$/i;
  783.     if(patn.test(x))
  784.     {
  785.         y.src = "file://localhost/" + x;
  786.     }
  787.     else
  788.     {
  789.         y.src = "/img/vClipper/nopreview.jpg";
  790.     }
  791. }
  792.  
  793. function PreviewImage2(x)
  794. {
  795.     var y = document.getElementById("PreviewImage2_Zone");
  796.     if(!x || !y) return;
  797.     var patn = /\.jpg$|\.jpeg$|\.gif$/i;
  798.     if(patn.test(x))
  799.     {
  800.         y.src = "file://localhost/" + x;
  801.     }
  802.     else
  803.     {
  804.         y.src = "/img/vClipper/nopreview.jpg";
  805.     }
  806. }
  807.  
  808. function AddLink(ID)
  809. {
  810.     
  811.     xajax_AddLink(PostID, document.getElementById('Input_PageLink_'+ID).value);
  812.     
  813.     var elSel = document.getElementById('Input_PageLink_'+ID);
  814.     var i;
  815.     for (i = elSel.length - 1; i>=0; i--)
  816.     {
  817.         if (elSel.options[i].selected)
  818.         {
  819.             elSel.remove(i);
  820.         }
  821.     }
  822.     
  823.     document.getElementById('Links_Panel_'+ID).style.display = 'none';
  824. }
  825.  
  826. function HoverSegment(ID, Type)
  827. {
  828.     if(Browser=='Explorer')
  829.         document.getElementById('Segment_'+ID).className = 'Segment_'+Type+' Segment_'+Type+'_hover';
  830.     document.getElementById('SegmentControl_'+ID).style.display='block';
  831. }
  832.  
  833. function LeaveSegment(ID, Type)
  834. {
  835.     if(Browser=='Explorer')
  836.         document.getElementById('Segment_'+ID).className = 'Segment_'+Type;
  837.     
  838.     document.getElementById('SegmentControl_'+ID).style.display='none';
  839. }
  840.  
  841. function OpenFile(path)
  842. {
  843.     window.status = 'file:///'+path;
  844.     setTimeout("window.status='';", 200);
  845. }
  846. var Duplicated=0;
  847. function Duplicate(obj)
  848. {
  849.     if(Duplicated==1)    return;
  850.     obj.innerHTML = "Duplicating...";
  851.     Duplicated = 1;
  852.     
  853.     xajax_DuplicatePage(PostID);
  854. }